domain_shutdown() needs to vcpu_pause_nosync() rather than directly
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 18 Mar 2008 15:23:25 +0000 (15:23 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 18 Mar 2008 15:23:25 +0000 (15:23 +0000)
incrementing the pause_count field. The latter ensures that the VCPU
gets descheduled --- synchronously in the case of the
currently-running VCPU.

Based on a bug report and proposed patch by Ben Guthro and Robert
Phillips of Virtual Iron.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
xen/common/domain.c

index 806468c052250361ea7f41ed13ec265d7916b682..bc9a7d9fad36e46bcdb51ad29f30c5c650090b1d 100644 (file)
@@ -110,10 +110,6 @@ static void __domain_finalise_shutdown(struct domain *d)
             return;
 
     d->is_shut_down = 1;
-
-    for_each_vcpu ( d, v )
-        vcpu_sleep_nosync(v);
-
     send_guest_global_virq(dom0, VIRQ_DOM_EXC);
 }
 
@@ -126,7 +122,7 @@ static void vcpu_check_shutdown(struct vcpu *v)
     if ( d->is_shutting_down )
     {
         if ( !v->paused_for_shutdown )
-            atomic_inc(&v->pause_count);
+            vcpu_pause_nosync(v);
         v->paused_for_shutdown = 1;
         v->defer_shutdown = 0;
         __domain_finalise_shutdown(d);
@@ -426,7 +422,7 @@ void domain_shutdown(struct domain *d, u8 reason)
     {
         if ( v->defer_shutdown )
             continue;
-        atomic_inc(&v->pause_count);
+        vcpu_pause_nosync(v);
         v->paused_for_shutdown = 1;
     }